<%@ page import="java.util.List" %>
<%@ page import="java.util.ArrayList" %>
<%@ page import="java.net.URLDecoder" %>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="com.zzc.bean.*" %>
<%--
  Created by IntelliJ IDEA.
  Employee: HP
  Date: 2017/11/7
  Time: 15:26
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://"
            + request.getServerName() + ":" + request.getServerPort()
            + path + "/";
%>
<script type="text/javascript" src="<%=path%>/assets/js/jquery-1.7.2.js"></script>
<script type="text/javascript" src="<%=path%>/assets/js/main.js"></script>
<script type="text/javascript" src="<%=path%>/assets/js/diningReceipt_opration.js"></script>
<script type="text/javascript" src="<%=path%>/assets/js/dateTool.js"></script>
<link href="<%=path%>/assets/bootstrap/css/bootstrap.css" rel="stylesheet" />
<link href="<%=path%>/css/toggle_button.css" rel="stylesheet" />
<!DOCTYPE html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Title</title>
    <script type="text/javascript">
        function submitButtonClick(){
            var isAdvance_string =$('#toggle-button').attr("checked");
            var isAdvance=true;
            if (isAdvance_string == 'checked') {
            } else {
                isAdvance=false;
            }
            var advanceDining_time =$('#advanceDining_time').val();
            var signDate_time =$('#signDate_time').val();
            var data = { isAdvance: isAdvance,advanceDining_time:advanceDining_time,signDate_time:signDate_time};
            $.post('<%=path%>/Action/Action_SystemSetAction_setAdvance', data, function (ret) {
                console.log(ret);
                if (ret&& ret.code === 200) {
                    console.log(ret.data);
                }
                else{
                    alert("似乎提交失败了，可能是网络问题");
                    location.reload();
                }
            }).fail(function () {
                alert('提交失败:网络错误?');
            });
        }
        function setAdvanceDining_time(){
            $("#advanceDining_time").attr("value",getFormatDate_dining());
        }
        $(function () {
            $("#toggle-button").change(function () {
                submitButtonClick();
            });
        });
    </script>
</head>
<body>
<%
    SystemSet systemSet= (SystemSet) request.getAttribute("systemSet");
    boolean isAdvance=systemSet.isAdvance();
    String signDate_time=systemSet.getSignDate();
    String advanceDining_time=systemSet.getAdvanceDiningDate();
%>
<%
    //筛选数据功能，汇总信息，汇总所有的公司
%>
<br/>
    El último día antes de las vacaciones:<input id="signDate_time" name="dining_time" type="date" value="2018-01-01"/><br/>
    La fecha de consumo para la reserva auto del último día antes de las vacaciones. :<input id="advanceDining_time" name="dining_time" type="date" value="2018-01-01"/><br/><br/>
    <span>¿Si funciona?:</span>
    <input type="checkbox" id="toggle-button">
    <!--label中的for跟input的id绑定。作用是在点击label时选中input或者取消选中input-->
    <label for="toggle-button" class="button-label">
        <span class="circle"></span>
        <span class="text on">On</span>
        <span class="text off">Off</span>
    </label><br/><br/><br/>
<div align="center">
    <button class="submit_button" onclick="submitButtonClick()">Entrega</button><br/>
</div>
</body>
</html>
<%
    if(isAdvance){
%>
<script>
    $('#toggle-button').attr("checked",true);
    $("#advanceDining_time").attr("value","<%=advanceDining_time%>");
</script>
<%
    }
%>
<%
    if(advanceDining_time!=null){
%>
<script>
    $("#advanceDining_time").attr("value","<%=advanceDining_time%>");
</script>
<%
}
else {
%>
<script>
    $("#advanceDining_time").attr("value",getFormatDate_dining());
</script>
<%
    }
%><%
    if(signDate_time!=null){
%>
<script>
    $("#signDate_time").attr("value","<%=signDate_time%>");
</script>
<%
}
else {
%>
<script>
    $("#signDate_time").attr("value",getNowFormatDate());
</script>
<%
    }
%>
